package com.cx.reactor.pubsub;

import java.util.concurrent.SubmissionPublisher;

/**
 * @Author:cxy
 * @Date:2022/3/5 20:08
 */
public class PublishExample {

    public static void main(String[] args) throws InterruptedException {
        final SubmissionPublisher publisher = new SubmissionPublisher();
        publisher.subscribe(new PrintSubscriber());

        for (int i = 0; i < 10; i++) {
            publisher.submit(i);
        }
        Thread.sleep(10000);
        publisher.close();

    }

}
